Lars Vilhuber
April 2019
We are going to review a fully reproducible example:
The Census Bureau put out a blog post with data.
the original page: http://researchmatters.blogs.census.gov/2016/12/01/how-much-do-startups-impact-employment-growth-in-the-u-s/
the replication project page: https://larsvilhuber.github.io/jobcreationblog/README.html
Original
Replicated
Consider the key inputs to this replication:
The role of journals is to provide a permanent record of scientific knowledge.
We use the Internet Archive
packrat or checkpoint functionality####################################
# global libraries used everywhere #
####################################
# Package lock in - optional
MRAN.snapshot <- "2019-01-01"
options(repos = c(CRAN = paste0("https://mran.revolutionanalytics.com/snapshot/",MRAN.snapshot)))
pkgTest <- function(x)
{
if (!require(x,character.only = TRUE))
{
install.packages(x,dep=TRUE)
if(!require(x,character.only = TRUE)) stop("Package not found")
}
return("OK")
}
global.libraries <- c("dplyr","devtools","rprojroot","tictoc")
results <- sapply(as.list(global.libraries), pkgTest)
// Make a path local to the project
// Also see my related config.do at
// https://gist.github.com/larsvilhuber/6bcf4ff820285a1f1b9cfff2c81ca02b
local pwd "/c/path/to/project"
capture mkdir `pwd'/ado
sysdir set PERSONAL `pwd'/ado/personal
sysdir set PLUS `pwd'/ado/plus
sysdir set SITE `pwd'/ado/site
/* Now install them */
/*--- SSC packages ---*/
foreach pkg in outreg esttab someprog {
ssc install `pkg'
}